package org.hackystat.projecttrajectory.test;

import org.junit.BeforeClass;

/**
 * Helper class that creates a test sensorbase and dailyprojectdata.
 * @author Cam Moore
 *
 */
public class ProjectTrajectoryTestHelper {

  private static org.hackystat.sensorbase.server.Server sensorBaseServer;
  private static org.hackystat.dailyprojectdata.server.Server dpdServer;
  private static org.hackystat.projecttrajectory.server.Server trajectoryServer;
  
  /**
   * Constructs a ProjectTrajectoryTestHelper.
   */
  public ProjectTrajectoryTestHelper() {
    // does nothing
  }
  
  /**
   * Starts the servers going for these tests. 
   * @throws Exception If problems occur setting up the server. 
   */
  @BeforeClass public static void setupServer() throws Exception {
    // Create a testing version of the Sensorbase.
    ProjectTrajectoryTestHelper.sensorBaseServer = 
      org.hackystat.sensorbase.server.Server.newTestInstance();
    ProjectTrajectoryTestHelper.dpdServer = 
      org.hackystat.dailyprojectdata.server.Server.newTestInstance();
    ProjectTrajectoryTestHelper.trajectoryServer = 
      org.hackystat.projecttrajectory.server.Server.newTestInstance();
  }

  /**
   * @return The ProjectTrajectory server.
   */
  public static org.hackystat.projecttrajectory.server.Server getProjectTrajectoryServer() {
    return trajectoryServer;
  }
  
  /**
   * @return The test dailyprojectdata URI as a String.
   */
  protected String getDailyProjectDataHostName() {
    return dpdServer.getHostName();
  }
    
  /**
   * @return The test sensorbase URI as a String.
   */
  protected String getSensorBaseHostName() {
    return sensorBaseServer.getHostName();
  }
  
  /**
   * @return The test projecttrajectory URI as a String.
   */
  protected String getProjectTrajectoryHostName() {
    return trajectoryServer.getHostName();
  }
}
